﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.BreedingInfoCommand;
using IntelligentAgriculture.WebAPI.Application.Command.GermlineHistoryRecordsCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.BreedingInfoCommandHandler
{
    /// <summary>
    /// 种母配种显示查询CommandHandler
    /// </summary>
    public class SelectBreedingInfoCommandHandler : IRequestHandler<SelectBreedingInfoCommand, Results<PageOutput<BreedingInfoOutPut>>>
    {

        private readonly IBreedingInfoService _service;
        public SelectBreedingInfoCommandHandler(IBreedingInfoService service)
        {
            _service = service;
        }


        public async Task<Results<PageOutput<BreedingInfoOutPut>>> Handle(SelectBreedingInfoCommand request, CancellationToken cancellationToken)
        {
            var list = await _service.GetBreedingInfoAsync(request.Input);
            return Results<PageOutput<BreedingInfoOutPut>>.DataResult(list);
        }
    }
}
